import pandas as pd

graph_name = "Yelp"

edges = pd.read_csv(f'./{graph_name}_edges.csv', usecols=[':START_ID', ':END_ID']) 
reverse_edges = edges.rename(columns={':START_ID': ':END_ID', ':END_ID': ':START_ID'})

all_edges = pd.concat([edges, reverse_edges], ignore_index=True)
all_edges = all_edges.drop_duplicates()
all_edges_sorted = all_edges.sort_values(by=[':START_ID', ':END_ID'])
all_edges_sorted.to_csv(f'./{graph_name}.ungraph', sep='\t', header=False, index=False)

print(f"============数据集{graph_name}的.ungraph文件生成完毕============")